package org.algorithm.biubiu.wheel_1.数组.三月.第三周;

/**
 * @Date 2022/3/16 20:23
 * @Created by biubiu
 * @Link {https://leetcode-cn.com/problems/climbing-stairs/}
 */
public class 爬楼梯 {

    public int climbStairs(int n) {
        if (n < 3) return n;

        int[] res = new int[n];
        res[0] = 1;
        res[1] = 2;
        for (int i = 2; i < n; i++) {
            res[i] = res[i - 1] + res[i - 2];
        }
        return res[n - 1];
    }
}
